import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDictServer extends TcpEchoServer{
    private Map<String, String> dict = new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);
        dict.put("people", "人");
        dict.put("tiger", "虎");
        dict.put("mouse", "鼠");
        dict.put("snake", "蛇");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request, "未找到该词汇");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer server = new TcpDictServer(9999);
        server.start();
    }
}
